package eerbaar.client.exp;

import eerbaar.client.internal.exp.Scope;

public class ScopeManager {

    private IScope current;
    private final Scope root;

    public ScopeManager() {
        root = new Scope(this, "root");
        this.current = root;
    }

    public IScope getCurrent() {
        return this.current;
    }

    public IScope getRoot() {
        return this.root;
    }

    public IScope popScope() {
        this.current = this.current.getParent();
        return this.current;
    }

    public IScope pushScope(String name) {
        this.current = new Scope(this, this.current, name);
        return this.current;
    }

}
